﻿using CPPEI.WebApi;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace CMS.WebApi.Media
{
    [AuthPostAction("media", "delete", "1.0")]
    public class DeleteAction : BaseAction<DeleteParams, DeleteResult>
    {
        protected override ActionResult<DeleteResult> OnExecute(ActionContext context, SysParams sysParams, DeleteParams opParams)
        {
            CMS.Domain.Services.DeleteService service = new Domain.Services.DeleteService();

            CPPEI.ServiceResult serResult = service.DeleteMedia(opParams.Id);

            if(serResult.IsSuccess)
            {
                DeleteResult actResult = new DeleteResult();
                return new ActionResult<DeleteResult>(actResult);
            }
            else
            {
                return new ActionResult<DeleteResult>(serResult);
            }
        }
    }

    public class DeleteParams
    {
        public Guid Id { get; set; }
    }

    public class DeleteResult
    {
    }
}
